<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>测试正则表达式[PCRE 匹配]</title>
<?php $str = $_GET['str'] ?>
</head>
<body>
<br />
<form action="RegExp.php" method="get">
请输入字符串: <input type="text" name="str" />
<input type="submit" />
</form>

'.'号包括自己吗[preg_replace('/./','包括',".\\ ");]：<table style="border:2px solid #E0E0E0;" ><tbody><tr><td>
<?php echo preg_replace('/./','包括',".\\ "); ?>
</td></tr></tbody></table>
<br />

'\b'的作用[preg_match('/\b\w+\b/',"The quick red fox jumped over the lazy brown dog");]：<table style="border:2px solid #E0E0E0;" ><tbody><tr><td>
<?php echo preg_match('/\b\w+\b/',"The quick red fox jumped over the lazy brown dog"); ?>
</td></tr></tbody></table>
<br />

'\b'的作用2 [preg_match_all('/\b\w+\b/',"The quick red fox jumped over the lazy brown dog");]：<table style="border:2px solid #E0E0E0;" ><tbody><tr><td>
<?php 
$arrayout = array(); //将得到二维数组
echo preg_match_all('/\b\w+\b/',"The quick red fox jumped over the lazy brown dog", $arrayout); 
echo '<hr />'.print_r($arrayout);
?>
</td></tr></tbody></table>
<br />

<?php
if (!isset($str)) 
	exit();

?>	
<br />你输入的内容是：<table style="border:2px solid #E0E0E0;" ><tbody><tr><td>
<?php echo $str; ?>
</td></tr></tbody></table>
<br />

数字变成'-'：<table style="border:2px solid #E0E0E0;" ><tbody><tr><td>
<?php echo preg_replace('/\d/','-',$str); ?>
</td></tr></tbody></table>
<br />


</body>
</html>